package com.neusoft.crm.controller;


import com.neusoft.crm.entity.Chance;
import com.neusoft.crm.service.IChanceService;
import com.neusoft.crm.tools.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDate;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lplpok
 * @since 2023-06-20
 */
@RestController
@RequestMapping("/chance")
@CrossOrigin
public class ChanceController {

    @Autowired
    private IChanceService chanceService;


    @GetMapping("/qry/list4feedback")
    public CommonResult qryList4FeedBack(String begin, String end, String customerno, String productno, String service){
        return chanceService.qryList4FeedBack(begin,end,customerno,productno,service);
    }

    @GetMapping("/qry/list")
    public CommonResult qryList(Integer customerno,Integer productno,String service){
        return chanceService.qryList(customerno,productno,service);
    }

    @PostMapping("/add")
    public CommonResult add_chance_data(@RequestBody Chance chance){
        chance.setChanceno(null);
        chanceService.save(chance);
        return new CommonResult(chance.getChanceno());
    }

    @PutMapping("/mod/approve")
    public CommonResult mod_chance_data(@RequestBody Chance chance){
        boolean b = chanceService.updateById(chance);
        return new CommonResult(b);
    }
    @GetMapping("/qry/fullbyno?chanceno=/{chanceno}")
    public CommonResult mod_data(@PathVariable String chanceno){
        return null;
    }

}
